package com.nashuju.web.controller.sw;

import org.durcframework.core.DefaultMessageResult;
import org.durcframework.core.GridResult;
import org.durcframework.core.MessageResult;
import org.durcframework.core.controller.CrudController;
import com.nashuju.web.entity.sw.SConstract;
import com.nashuju.web.entity.sw.SConstractSch;
import com.nashuju.web.service.sw.SConstractService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class SConstractController extends
		CrudController<SConstract, SConstractService> {

		//新增记录
	@RequestMapping("/addSConstract.do")
	public @ResponseBody
	MessageResult addSConstract(SConstract entity) {
		
		if(this.getService().createSTaskSchedule(entity))
		{
			return this.save(entity);
		}
		return error("合同创建失败！");
	}

	//删除记录
	@RequestMapping("/delSConstract.do")
	public @ResponseBody
	MessageResult delSConstract(SConstract entity) {
		if(this.getService().delSTaskSchedule(entity))
		{
			return this.delete(entity);
		};
		return error("合同删除失败！");
	}
	
	//修改记录
	@RequestMapping("/updateSConstract.do")
	public @ResponseBody
	MessageResult updateSConstract(SConstract entity) {
		return this.update(entity);
	}

	//条件查询分页操作
	@RequestMapping("/listSConstract.do")
	public @ResponseBody
	GridResult listSConstract(SConstractSch searchEntitySch) {
		return this.query(searchEntitySch);
	}

	
	//条件查询并返回所有记录
	@RequestMapping("/listAllSConstract.do")
    public @ResponseBody Object listAllSConstract(SConstractSch searchEntitySch) {
        return this.queryAll(searchEntitySch);
    }

    //获取详细信息
	@RequestMapping("/getSConstractById.do")
    public @ResponseBody SConstract getSConstractById(SConstract entity) {
        return this.getService().get(entity.getId());
    }

 	

}